<!-- 探槽-点 -->
<template>
  <el-drawer v-model="addDrawer" size="48%" :show-close="false" @opened="openDrawer"
    @close="closeDrawer">
    <template #title>
      <el-space direction="vertical" class="space-width100">
        <div v-if="route.path.includes('dataIntegrate') && form.qcOpinion">
          <el-form :model="form" :inline="true" label-width="140px">
            <el-form-item label="质检不通过原因" style="width: 100%">
              <el-input v-model="form.qcOpinion" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" resize="none"
                clearable></el-input>
            </el-form-item>
          </el-form>
        </div>
        <h2>
          <el-row justify="space-between">
            <span><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></span>
            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading"
              v-if="isShowSave">保存</el-button>
          </el-row>
        </h2>
      </el-space>
    </template>
    <template #default>
      <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="160px" v-loading="drawerLoading">
        <el-row justify="space-between">
          <el-form-item label="省">
            <el-input v-model="form.province" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="市">
            <el-input v-model="form.city" clearable disabled></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="区/县">
            <el-input v-model="form.county" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="探槽编号" prop="id">
            <el-input v-model="form.id" placeholder="请输入探槽编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="所属地质调查工程编号" prop="geologySvyProjectId">
            <el-input v-model="form.geologySvyProjectId" placeholder="请输入所属地质调查工程编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="野外编号" prop="fieldId" style="width: 100%">
            <el-input v-model="form.fieldId" placeholder="请输入野外编号" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea"
              show-word-limit maxlength="50" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="目标断层编号" prop="targetFaultId">
            <el-input v-model="form.targetFaultId" placeholder="请输入目标断层编号" clearable maxlength="17"></el-input>
          </el-form-item>
          <el-form-item label="目标断层来源" prop="targetFaultSource" style="width: 100%">
            <dict-select code="FaultSourceCVD" :value="form.targetFaultSource" @update="updateDict('targetFaultSource', $event)"></dict-select>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="目标断层名称" prop="targetFaultName" style="width: 100%">
            <el-input v-model="form.targetFaultName" placeholder="请输入目标断层名称" :autosize="{ minRows: 2, maxRows: 4 }"
              type="textarea" show-word-limit maxlength="50" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽名称" prop="targetFaultName" style="width: 100%">
            <el-input v-model="form.targetFaultName" placeholder="请输入探槽名称" :autosize="{ minRows: 2, maxRows: 4 }"
              type="textarea" show-word-limit maxlength="40" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽来源与类型" prop="trenchSource">
            <dict-select code="TrenchTypeCVD" :value="form.trenchSource" @update="updateDict('trenchSource', $event)"></dict-select>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="收集探槽来源补充说明" prop="collectedTrenchSource" style="width:100%">
            <el-input v-model="form.collectedTrenchSource" placeholder="请输入收集探槽来源补充说明"
              :autosize="{ minRows: 4, maxRows: 8 }" type="textarea" show-word-limit maxlength="255" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="经度" prop="lon">
            <el-input v-model="form.lon" placeholder="请输入经度" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="纬度" prop="lat">
            <el-input v-model="form.lat" placeholder="请输入纬度" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="高程 [米]" prop="elevation">
            <el-input v-model="form.elevation" placeholder="请输入高程 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽方向角度 [度]" prop="trenchDip">
            <el-input v-model.number="form.trenchDip" placeholder="请输入探槽方向角度 [度]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="参考位置" prop="locationName" style="width:100%">
            <el-input v-model="form.locationName" placeholder="请输入参考位置" :autosize="{ minRows: 3, maxRows: 8 }"
              type="textarea" show-word-limit maxlength="100" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="地貌环境" prop="geomophEnv" style="width:100%">
            <el-input v-model="form.geomophEnv" placeholder="请输入地貌环境" :autosize="{ minRows: 2, maxRows: 4 }"
              type="textarea" show-word-limit maxlength="40" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="环境照片图像编号" prop="photoAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.photoAiid" placeholder="请输入环境照片图像编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.photoAiidName" @uploadImage="uploadSuccess('photoAiid', $event)" @delFile="deleteFile('photoAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="环境照片原始文件编号" prop="photoArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.photoArwid" placeholder="请输入典型照片原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.photoArwidName" @uploadFile="uploadSuccess('photoArwid', $event)" @delFile="deleteFile('photoArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="照片镜向" prop="photoViewingTo">
            <dict-select code="CVD-16-Direction" :value="form.photoViewingTo" @update="updateDict('photoViewingTo', $event)"></dict-select>
          </el-form-item>
          <el-form-item label="拍摄者" prop="photographer">
            <el-input v-model="form.photographer" placeholder="请输入拍摄者" clearable maxlength="20"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽长 [米]" prop="length">
            <el-input v-model.number="form.length" placeholder="请输入探槽长 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="探槽宽 [米]" prop="width">
            <el-input v-model.number="form.width" placeholder="请输入探槽宽 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽深 [米]" prop="depth">
            <el-input v-model.number="form.depth" placeholder="请输入探槽深 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="揭露地层数" prop="exposedStratumCount">
            <el-input v-model.number="form.exposedStratumCount" placeholder="请输入揭露地层数" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="古地震事件次数" prop="eqEventCount">
            <el-input v-model.number="form.eqEventCount" placeholder="请输入古地震事件次数" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="最晚古地震发震时代" prop="latestEqPeroidEst">
            <el-input v-model.number="form.latestEqPeroidEst" placeholder="请输入最晚古地震发震时代" clearable
              maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="最晚古地震发震时代误差" prop="latestEqPeroidEr">
            <el-input v-model="form.latestEqPeroidEr" placeholder="请输入最晚古地震发震时代误差" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="采集样品总数" prop="collectedSampleCount">
            <el-input v-model="form.collectedSampleCount" placeholder="请输入采集样品总数" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="送样总数" prop="sampleCount">
            <el-input v-model="form.sampleCount" placeholder="请输入送样总数" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="获得结果的样品数" prop="datingSampleCount">
            <el-input v-model="form.datingSampleCount" placeholder="请输入获得结果的样品数" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面图1图像文件编号" prop="profile1Aiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile1Aiid" placeholder="请输入探槽剖面图1图像文件编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.profile1AiidName" @uploadImage="uploadSuccess('profile1Aiid', $event)" @delFile="deleteFile('profile1Aiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面图1原始文件编号" prop="profile1Arwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile1Arwid" placeholder="请输入探槽剖面图1原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.profile1ArwidName" @uploadFile="uploadSuccess('profile1Arwid', $event)" @delFile="deleteFile('profile1Arwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面地层描述1文件编号" prop="profile1CommentArid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile1CommentArid" placeholder="请输入探槽剖面地层描述1文件编号" clearable
                maxlength="20"></el-input>
              <FileUpload v-model="form.profile1CommentAridName" @uploadFile="uploadSuccess('profile1CommentArid', $event)" @delFile="deleteFile('profile1CommentArid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面地层描述1原始文件编号" prop="profile1CommentArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile1CommentArwid" placeholder="请输入探槽剖面地层描述1原始文件编号" clearable
                maxlength="20"></el-input>
              <FileUpload v-model="form.profile1CommentArwidName" @uploadFile="uploadSuccess('profile1CommentArwid', $event)" @delFile="deleteFile('profile1CommentArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面图1拼接照片图像文件编号" prop="profile1PhotoAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile1PhotoAiid" placeholder="请输入探槽剖面图1拼接照片图像文件编号" clearable
                maxlength="20"></el-input>
              <ImageUpload v-model="form.profile1PhotoAiidName" @uploadImage="uploadSuccess('profile1PhotoAiid', $event)" @delFile="deleteFile('profile1PhotoAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面图1照片原始文件编号" prop="profile1PhotoArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile1PhotoArwid" placeholder="请输入探槽剖面图1照片原始文件编号" clearable
                maxlength="20"></el-input>
              <FileUpload v-model="form.profile1PhotoArwidName" @uploadFile="uploadSuccess('profile1PhotoArwid', $event)" @delFile="deleteFile('profile1PhotoArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面图2图像文件编号" prop="profile2Aiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile2Aiid" placeholder="请输入探槽剖面图2图像文件编号" clearable maxlength="20"></el-input>
              <ImageUpload v-model="form.profile2AiidName" @uploadImage="uploadSuccess('profile2Aiid', $event)" @delFile="deleteFile('profile2Aiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面图2原始文件编号" prop="profile2Arwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile2Arwid" placeholder="请输入探槽剖面图2原始文件编号" clearable maxlength="20"></el-input>
              <FileUpload v-model="form.profile2ArwidName" @uploadFile="uploadSuccess('profile2Arwid', $event)" @delFile="deleteFile('profile2Arwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面地层描述2文件编号" prop="profile2CommentArid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile2CommentArid" placeholder="请输入探槽剖面地层描述2文件编号" clearable
                maxlength="20"></el-input>
              <ImageUpload v-model="form.profile2CommentAridName" @uploadImage="uploadSuccess('profile2CommentArid', $event)" @delFile="deleteFile('profile2CommentArid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面地层描述2原始文件编号" prop="profile2CommentArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile2CommentArwid" placeholder="请输入探槽剖面地层描述2原始文件编号" clearable
                maxlength="20"></el-input>
              <FileUpload v-model="form.profile2CommentArwidName" @uploadFile="uploadSuccess('profile2CommentArwid', $event)" @delFile="deleteFile('profile2CommentArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面图2拼接照片图像文件编号" prop="profile2PhotoAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile2PhotoAiid" placeholder="请输入探槽剖面图2拼接照片图像文件编号" clearable
                maxlength="20"></el-input>
              <ImageUpload v-model="form.profile2PhotoAiidName" @uploadImage="uploadSuccess('profile2PhotoAiid', $event)" @delFile="deleteFile('profile2PhotoAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽剖面图2照片原始文件编号" prop="profile2PhotoArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.profile2PhotoArwid" placeholder="请输入探槽剖面图2照片原始文件编号" clearable
                maxlength="20"></el-input>
              <FileUpload v-model="form.profile2PhotoArwidName" @uploadFile="uploadSuccess('profile2PhotoArwid', $event)" @delFile="deleteFile('profile2PhotoArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="符号或标注旋转角度" prop="lastAngle">
            <el-input v-model.number="form.lastAngle" placeholder="请输入符号或标注旋转角度" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探槽描述" prop="commentInfo" style="width:100%">
            <el-input v-model="form.commentInfo" placeholder="请输入探槽描述" :autosize="{ minRows: 6, maxRows: 12 }"
              type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
          </el-form-item>
        </el-row>
      </el-form>
    </template>
  </el-drawer>
</template>
<script setup>
import useSpatialData from '@/hooks/useSpatialData'
import { rangeValidate, eightDouble, fourInt } from '@/utils/validate'
import { getDict } from '@/api/system/dict'
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, uploadSuccess, deleteFile, updateDict, isShowSave } = useSpatialData()
const formRules = {
  id: [{ required: true, message: '请填写探槽编号！', trigger: 'blur' }],
  fieldId: [{ required: true, message: '请填写野外编号！', trigger: 'blur' }],
  targetFaultSource: [{ required: true, message: '请填写目标断层来源！', trigger: 'blur' }],
  targetFaultName: [{ required: true, message: '请填写目标断层名称！', trigger: 'blur' }],
  name: [{ required: true, message: '请填写探槽名称！', trigger: 'blur' }],
  lon: [eightDouble],
  lat: [eightDouble],
  elevation: [eightDouble],
  trenchDip: [{ type: 'number', message: '请输入整数' }, { min: 0, max: 359, validator: rangeValidate }],
  length: [eightDouble],
  width: [eightDouble],
  depth: [eightDouble],
  exposedStratumCount: [fourInt],
  eqEventCount: [fourInt],
  latestEqPeroidEst: [fourInt],
  latestEqPeroidEr: [fourInt],
  collectedSampleCount: [fourInt],
  sampleCount: [fourInt],
  datingSampleCount: [fourInt],
  lastAngle: [eightDouble]
}
</script>
<style scoped></style>